package com.iuhao.orange.page;

import com.fasterxml.jackson.annotation.JsonIgnore;

import java.io.Serializable;

/**
 * 页码类
 *
 * @author yanhao
 * @date 2018年2月10日
 */
public class Page implements Serializable {
    /**
     * 当前页
     */
    public Integer num = 1;
    /**
     * 每页数
     */
    public Integer row = 10;
    /**
     * 分页起始位置
     */
    @JsonIgnore
    private Integer start;
    /**
     * 排序字段
     */
    @JsonIgnore
    private String sort;

    public Page() {
        super();
    }

    public Integer getNum() {
        return num;
    }

    public void setNum(Integer num) {
        if (num == null || num < 0) {
            return;
        }
        this.num = num;
    }

    public Integer getRow() {
        return row;
    }

    public void setRow(Integer row) {
        this.row = row;
    }

    public Integer getStart() {
        if (num != null && row != null) {
            start = (num - 1) * row;
        }
        return start;
    }

    public String getSort() {
        return sort;
    }

    public void setSort(String sort) {
        this.sort = sort;
    }

}
